<template>
  <div class="container">
    <div class="product">
      <div class="product-list" v-for="item in 22" :key="item">
        <ul class="product-list-content">
          <li class="list-img">
            <img src="@/assets/images/16.jpg" alt="商品图片" />
          </li>
          <li class="list-text">
            <span class="list-text-icon">自营</span>
            博世(BOSCH) 四坑1系(4坑2刃)电锤钻头 6x100/160 2608680263
          </li>
          <li class="list-price-content">
            <span class="list-rmb">￥</span>
            <span class="list-price">
              4159.
              <i>00</i>
            </span>
            <span class="list-sales">销量20万+</span>
          </li>
          <li class="list-cart">
            <el-icon>
              <i-ep-shopping-trolley />
            </el-icon>
            <span>加入购物车</span>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts"></script>

<style scoped lang="scss">
.container {
  width: 100%;
  max-width: 74.375rem; /* 设置最大宽度 */
  margin: 0 auto; /* 使容器居中 */
}

.product {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13.75rem, 1fr));
  gap: 1rem;
}

.product-list {
  background-color: #fff;
  width: 100%;
  border-radius: 0.5rem;
  box-sizing: border-box;
  cursor: pointer;

  .product-list-content {
    padding: 0.625rem;

    li:not(:last-child) {
      margin-bottom: 0.5rem;
    }

    .list-img {
      width: 100%;
      margin: 0 auto;

      img {
        border-radius: 0.5rem;
      }
    }

    .list-text {
      display: -webkit-box;
      overflow: hidden;
      text-overflow: ellipsis;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      font-size: 0.75rem;
      color: rgba(0, 0, 0, 0.85);

      .list-text-icon {
        width: 2rem;
        height: 1rem;
        margin-right: 0.1875rem;
        background: #f2270c;
        border-radius: 0.125rem;
        text-align: center;
        color: #fff;
      }
    }

    .list-price-content {
      font-size: 1rem;
      color: #ff0f23;

      .list-rmb {
        font-weight: 700;
      }

      .list-price {
        font-size: 1.5rem;
        font-weight: 700;

        i {
          font-size: 1rem;
        }
      }

      .list-sales {
        font-size: 0.875rem;
        color: #8c8c8c;
        margin-left: 0.5rem;
      }
    }
  }

  .list-cart {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5em;
    font-size: 0.875rem;
    border-radius: 0.5rem;
    padding: 0.25rem 0;
    border: 0.0625rem solid #ff0f23;

    &:hover {
      background: #ff0f23;
      color: #fff;
    }
  }
}
</style>
